﻿@model AddPushMsgModel

@{
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@{
    var viewModel = Model ?? new AddPushMsgModel();
}
<form id="S_Form" action="@Url.Action("addPushMsg", "PushMsg")" method="post" class="definewidth m20">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td colspan="2">
                <h5>
                    @ViewBag.Title，请输入消息内容，标<em>*</em>号是必填或必选项。
                </h5>
                <input type="hidden" value="0" name="aDZ_Pushmessage.ReceiveType" />
                <input type="hidden" value="@viewModel.aDZ_Pushmessage.ID" name="aDZ_Pushmessage.ID" />
            </td>
        </tr>
        <tr>
            <td width="10%" class="tableleft">标题<em></em></td>
            <td><input type="text" id="aDZ_Pushmessage.MsgTitle" name="aDZ_Pushmessage.MsgTitle" maxlength="100" value="@viewModel.aDZ_Pushmessage.MsgTitle" /></td>
        </tr>
        <tr>
            <td class="tableleft">内容<em>*</em></td>
            <td><textarea name="aDZ_Pushmessage.MsgText" style="width:80%;height:300px;" maxlength="2500">@viewModel.aDZ_Pushmessage.MsgText</textarea></td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <p><span id="spMsg"></span></p>
                <button type="submit" class="btn btn-primary">保存</button> &nbsp;&nbsp;
                <button type="button" class="btn btn-success" name="backid" id="backid">返回</button>
            </td>

        </tr>
    </table>
    <script>
        BUI.use('bui/overlay', function (overlay) {
            $(function () {
               

                var rules = {
                    'aDZ_Pushmessage.MsgText': { required: true }
                };

                var validator = $('form').validate({
                    errorLabelContainer: $("#errorContainer"),
                    errorElement: "span",
                    rules: rules,
                    submitHandler: function (form) {
                        $(form).ajaxSubmit(function (result) {
                            ShowActionResult(result, function () { self.location = "@Url.Action("PushMsgList", "PushMsg")"; });
                        });
                    }
                });

            });
        });



    </script>
</form>
